package app.thread;

import extend.db.base.SqlMap;
import extend.db.transaction.Trans;
import hehe.User;

/**
 * Created by xfw on 17-6-12.
 */
public class DbThread extends Thread
{
    private String name;
    public DbThread(String name) {
        this.name=name;
    }

    public void run() {

//        System.out.println("trans status before:" + Trans.transOn());
//        // 开启事务
//        Trans.beginTransaction();
//        SqlMap data = new SqlMap();
//        String UserName = "name:" +  Math.random();
//        data.put("UserName",UserName + ",no:" + Thread.currentThread().getId());
//        User user = new User();
//        int result = user.addOne(data);
//        System.out.println("trans status after:" + Trans.transOn() + ",add result:" + result);
//
//        Trans.commit();
//        System.out.println("currentThread no " + Thread.currentThread().getId());
//        System.out.println("");
    }
}
